package yxy.game.pm2.bean.pubsub;

import yxy.apple.util.PubSub.ISubscription;
import yxy.apple.util.PubSub.Publisher;
import yxy.game.pm2.bean.Hero;
import yxy.game.pm2.bean.mq.CCReason;

/** 武将星级发布 */
public class HeroStarPublisher extends Publisher {
	static private HeroStarPublisher instance;

	public static HeroStarPublisher getInstance() {
		if (instance == null) {
			instance = new HeroStarPublisher();
		}
		return instance;
	}

	private HeroStarPublisher() {

	}

	public void publish(String playerCode,CCReason reason, Hero hero) {
		this.publish(new HeroStarSubscription(playerCode, reason, hero));
	}

	public static class HeroStarSubscription implements ISubscription {
		private String playerCode;
		private CCReason reason;	//变动原因
		private Hero hero;

		public HeroStarSubscription(String playerCode, CCReason reason, Hero hero) {
			this.playerCode = playerCode;
			this.reason = reason;
			this.hero = hero;
		}

		public String getPlayerCode() {
			return playerCode;
		}
		public CCReason getReason() {
			return reason;
		}
		public Hero getHero() {
			return hero;
		}
	}
}
